package com.xdq.spring.service;

import com.xdq.spring.model.Wheel;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Service
@Scope("singleton")
public class WheelProducer {

    private List<Wheel> wheels = new ArrayList<>();

    public WheelProducer(){
        System.out.println("WheelProducer被实例化了");
    }

    public List<Wheel> produces(String specification,int count) {
        for (int i = 0; i < count; i++) {
            Wheel wheel = new Wheel();
            wheel.setBrand("chaoyang");
            wheel.setSpecification(specification);
            wheel.setCreateDate(String.valueOf(System.currentTimeMillis()));
            wheel.setSerialNo(UUID.randomUUID().toString());
            wheels.add(wheel);
        }
        return wheels;
    }
}
